<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Function random</title>
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../../index.html" title="Boost.Test">
<link rel="up" href="../../../header/boost/test/data/monomorphic/generators/random_hpp.html" title="Header &lt;boost/test/data/monomorphic/generators/random.hpp&gt;">
<link rel="prev" href="monomorphic/random_t.html" title="Class template random_t">
<link rel="next" href="../../../header/boost/test/data/monomorphic/generators/xrange_hpp.html" title="Header &lt;boost/test/data/monomorphic/generators/xrange.hpp&gt;">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="monomorphic/random_t.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../header/boost/test/data/monomorphic/generators/random_hpp.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../../../header/boost/test/data/monomorphic/generators/xrange_hpp.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boost.unit_test.data.random"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Function random</span></h2>
<p>boost::unit_test::data::random — Returns an infinite sequence of random numbers. </p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../../header/boost/test/data/monomorphic/generators/random_hpp.html" title="Header &lt;boost/test/data/monomorphic/generators/random.hpp&gt;">boost/test/data/monomorphic/generators/random.hpp</a>&gt;

</span>
<a class="link" href="monomorphic/generated_by.html" title="Class template generated_by">monomorphic::generated_by</a><span class="special">&lt;</span> <a class="link" href="monomorphic/random_t.html" title="Class template random_t">monomorphic::random_t</a><span class="special">&lt;</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">random</span><span class="special">(</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> SampleType<span class="special">&gt;</span> 
  <a class="link" href="monomorphic/generated_by.html" title="Class template generated_by">monomorphic::generated_by</a><span class="special">&lt;</span> <a class="link" href="monomorphic/random_t.html" title="Class template random_t">monomorphic::random_t</a><span class="special">&lt;</span> <span class="identifier">SampleType</span> <span class="special">&gt;</span> <span class="special">&gt;</span> 
  <span class="identifier">random</span><span class="special">(</span><span class="identifier">SampleType</span> begin<span class="special">,</span> <span class="identifier">SampleType</span> end<span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Params<span class="special">&gt;</span> <span class="emphasis"><em><span class="identifier">unspecified</span></em></span> <span class="identifier">random</span><span class="special">(</span><span class="identifier">Params</span> <span class="keyword">const</span> <span class="special">&amp;</span> params<span class="special">)</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="idm45175"></a><h2>Description</h2>
<p>The following overloads are available: </p>
<pre class="programlisting"><span class="keyword">auto</span> <span class="identifier">d</span> <span class="special">=</span> <span class="identifier">random</span><span class="special">(</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">auto</span> <span class="identifier">d</span> <span class="special">=</span> <span class="identifier">random</span><span class="special">(</span><span class="identifier">begin</span><span class="special">,</span> <span class="identifier">end</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">auto</span> <span class="identifier">d</span> <span class="special">=</span> <span class="identifier">random</span><span class="special">(</span><span class="identifier">params</span><span class="special">)</span><span class="special">;</span>
</pre>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem"><p>The first overload uses the default distribution, which is uniform and which elements are <code class="computeroutput">double</code> type (the values are in [0, 1) ).</p></li>
<li class="listitem"><p>The second overload generates numbers in the given interval. The distribution is uniform (in [begin, end) for real numbers, and in [begin, end] for integers). The type of the distribution is deduced from the type of the <code class="computeroutput">begin</code> and <code class="computeroutput">end</code> parameters.</p></li>
<li class="listitem">
<p>The third overload generates numbers using the named parameter inside <code class="computeroutput">params</code> , which are:</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem"><p><code class="computeroutput">distribution:</code> the distribution used. In this overload, since the type of the samples cannot be deduced, the samples are of type <code class="computeroutput">double</code> and the distribution is uniform real in [0, 1).</p></li>
<li class="listitem"><p><code class="computeroutput">seed:</code> the seed for generating the values</p></li>
<li class="listitem"><p><code class="computeroutput">engine:</code> the random number generator engine</p></li>
</ul></div>
<p>
</p>
</li>
</ul></div>
<p>
</p>
<p>The function returns an object that implements the dataset API. </p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>This function is available only for C++11 capable compilers. </p></td></tr>
</table></div>
<p>
</p>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2001-2022 Boost.Test contributors<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="monomorphic/random_t.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../header/boost/test/data/monomorphic/generators/random_hpp.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../../../header/boost/test/data/monomorphic/generators/xrange_hpp.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
